@layout("/common/_container.html"){
<style>
    .box_shou{  text-align: center; }
    .btn_1,.btn_2{ margin: 0 3rem 0 16rem; }
    .box_del{ text-align:center;}
    .box_del span{ font-size: 2rem;}
    .layui-layer-title{background-color:#D7D7D7;}
    .layui-layer-title{ font-size: 22px;    letter-spacing: 25px;}
    .tit{font-size: 2rem; color: #000000; margin: .3em 0 .3em 1.7em;}
    .tit_s{font-size: 1.5em; margin: .3em 0 .3em 1.7em; float:left;color: #000000;padding-right: 1em;}
    .tit_ss{font-size: 1.5em; margin: .3em 0 .3em 0; float:left;color: #000000;padding-right: 1em;font-weight: 400;}
    .file{float:left;}
    .box_2,.box_3,.box_4,.box_5,.box_6,.box_7,.box_8{clear: both; }
    input[type='checkbox']{ float:left;    margin-top: 1em;}
    input[type='date']{margin-top: .6em;}
    input[type='file']{    opacity: 0;    height: 62px;    z-index: 10000;    width:62px; margin-bottom: 0;}
    select{ margin-top:.6em;height: 1.7em;}
    .box_4{font-size: 1.5em; margin: .3em 0 .3em 1.2em; float:left;color: #000000;padding-right: 1em; width: 100%; }
    .box_5,.box_6,.box_7{ margin-left:1.7em; display:none;}
    .tishi{padding-left: 2.5em;}
    .line{height: .1em;width:100%;color:#797979;background-color:#797979; margin: 1.4em 0 .7em 0;}
    #isCondition{margin-top:.4em;}
    .img_up{position: relative; left: -6.5em;top: -.5em;}
    .err{display:none;}
    .add_{ background-color:#D7D7D7;font-size:22px;letter-spacing: 25px;}

</style>
<input type="hidden" id="id" value="${shortcuts.id}">
<div class="layui-layer-content">
    <div class="tit"><strong>基础信息：</strong><span class="red_hint"></span></div>
    <div class="box_1"><span class="tit_s">功能图标：</span>
        <input type="file" class="file" id="shortcuts_img"  onchange="previewFile();"/><img class="img_up" src="../../../../static/img/uploading.png"/>
        <img id="show_img" src="${shortcuts.shortcuts_img}" height="58" style="    margin-bottom: 17px;" >
        <span id="file_name"></span>
    </div>
    <div class="box_2"><span class="tit_s">功能标题： </span><input type="text" value="${shortcuts.functional_title}" id="functional_title" maxlength="6"/><span class="tishi">备注：不能超过6个字</span></div>
    <div class="box_2"><span class="tit_s">产品类型：</span>

        <select id="goodsCode" name="产品类型">
            <option value="" selected="selected"></option>
            @for(good in goods){
            @if(good.goodsCode ==  shortcuts.goods_code){
            <option value="${shortcuts.goods_code}" selected="selected">${good.goodsName}</option>
            @}
            @if(good.goodsCode !=  shortcuts.goods_code){
            <option value="${good.goodsCode}">${good.goodsName}</option>
            @}

            @}
        </select>
    </div>
    <div class="box_3"><span class="tit_s">跳转地址：</span> <input type="text" value="${shortcuts.shortcuts_url}" id="shortcuts_url" /><span
            class="tishi">备注点击后跳转的页面</span></div>
    <div class="line"></div>
    <div class="box_4"><input id="isCondition" type="checkbox" value="${shortcuts.isCondition}"/><strong>限制条件：</strong>（仅符合条件的用户可见）</div>
    <div class="box_5">
         <span
            class="tit_ss">开启有效时间：</span><input type="date" class="dates" id="start_time" value="${shortcuts.start_time}"/> — <input type="date" class="dates" id="end_time" value="${shortcuts.end_time}"/>
        <span class="stime"></span>
    </div>
    <div class="box_6">
         <span
            class="tit_ss"> 用户注册时间：</span><input type="date" class="dates" id="register_start_time" value="${shortcuts.register_start_time}"/> — <input type="date" class="dates" id="register_end_time" value="${shortcuts.register_end_time}"/>
        <span class="stime1"></span>
    </div>
    <div class="box_7">
         <span class="tit_ss">互斥产品类型：</span>
        <select id="mutex__code" name="互斥产品类型">
            <option value="" selected="selected"></option>
            @for(good in goods){
                @if(good.goodsCode ==  shortcuts.mutex__code){
                    <option value="${shortcuts.mutex__code}" selected="selected">${good.goodsName}</option>
                @}
                @if(good.goodsCode !=  shortcuts.mutex__code){
                    <option value="${good.goodsCode}">${good.goodsName}</option>
                @}
            @}
            <!--
            <option value="3">注册比比旅行会员</option>
            <option value="2">每日签到</option>
            <option value="1">邀请用户注册</option>-->
        </select>
        <span class="err">不能和产品类型相同</span>
    </div>
    <div class="box_8">
        <button type="button" class="btn btn-info btn_1" onclick="ShortcutsInfoDlg.editSubmit()" id="ensures">
            <i class="fa fa-check"></i>&nbsp;提交
        </button>
        <a class="layui-layer-ico layui-layer-close layui-layer-close1" href="javascript:;">
            <button type="button" class="btn btn-danger btn_2  layui-layer-close"  onclick="ShortcutsInfoDlg.close()" id="del1_add">
                <i class="fa fa-eraser"></i>&nbsp;取消
            </button></a>
    </div>

    <!--    </div>
    </div>-->

</div>
<script>
    $(document).ready(function(){
        var te1 = $("#goodsCode").val();
        var te2 = $("#mutex__code").val();
        if(te1 == te2){
            $("#mutex__code").val("0");
            $(".err").show();
            return false;
        }
       var iscondition = $("#isCondition").val();
       if(iscondition ==1 ){
            $("#isCondition").attr("checked","checked");
            $(".box_5").show();
            $(".box_6").show();
            $(".box_7").show();
       }
       var start_time = $("#start_time").val();
        if(start_time){
            $("#open_valid").attr("checked","checked")
        }
        var register_start_time = $("#register_start_time").val();
        if(register_start_time){
            $("#user_register").attr("checked","checked");
        }
        var mutex__code = $("#mutex__code").val();
        if(mutex__code){
            $("#mutual").attr("checked","checked");
        }
    })
    function close1(){
        $("#layui-layer-shade2").css("display","none");
        $("#layui-layer2").css("display","none");
        return;
    }
    $("#shortcuts_img").change(function(){
        var obj = document.getElementById("shortcuts_img");
        var temp = obj.files[0].name;
        $("#file_name").text(temp);
    });
    $("#open_valid").change(function(){
        if($("#open_valid").prop("checked")){
            $("#open_valid").val("1");
        }else{
            $("#open_valid").val("0");
        }
    });
    $("#user_register").change(function(){
        if($("#user_register").prop("checked")){
            $("#user_register").val("1");
        }else{
            $("#user_register").val("0");
        }
    });
    $("#mutual").change(function(){
        if($("#mutual").prop("checked")){
            $("#mutual").val("1");
        }else{
            $("#mutual").val("0");
        }
    });
    $("#isCondition").change(function (){
        if($("#isCondition").prop("checked")){
            $("#isCondition").val("1");
            $(".box_5").show();
            $(".box_6").show();
            $(".box_7").show();
        }else{
            $("#isCondition").val("0");
            $(".box_5").hide();
            $(".box_6").hide();
            $(".box_7").hide();
        }
    });
    $("#mutex__code").change(function (){
        $(".err").hide();
        var te1 = $("#goodsCode").val();
        var te2 = $("#mutex__code").val();
        if(te1 == te2){
            $("#mutex__code").val("0");
            $(".err").show();
            return false;
        }
    });
    $("#start_time").val()
 function previewFile() {
        var preview = document.querySelector('#show_img');
        var file = document.querySelector('input[type=file]').files[0];
        var reader = new FileReader();
        reader.onloadend = function () {
            preview.src = reader.result;
        }

        if (file) {
            reader.readAsDataURL(file);
        } else {
            preview.src = "";
        }
    }
</script>
<script src="${ctxPath}/static/modular/packback/shortcuts/shortcuts_info.js"></script>
@}
